<?php
namespace app\api\controller;
use think\Controller;
use think\Db;
class News extends Controller
{
    //处理跨域请求
    public function __construct(){
        header('Access-Control-Allow-Origin:*');
        header('Access-Control-Allow-Methods:GET, POST, OPTIONS');
    }
    
    //新闻类表
    public function newlist(){
        $type = $_POST['newstype'];
        $res = Db::name('journalisminfo')
        ->where('journalism_type',$type)
        -> select();
        
        return json($res);
    }
}

?>